from car import Car

class Battery():
    def __init__(self, make="CATL", size=500):
        self.size = size
        self.make = make
    
    def describe_battery(self):
        print("This car has a " + str(self.size) + "-kWh battery." + \
              "It's manufacturer is " + self.make + ".")

    def get_range(self):
        if self.size == 500:
            range = 400
        elif self.size == 700:
            range = 700
        msg = "This car can go approximately " + str(range)
        msg += " miles on a full charge."
        print(msg)

    def upgrade_battery(self):
        if self.size != 700:
            self.size  = 700

class ElectricCar(Car):
    def __init__(self, make, model, year):
        """
        初始化父类的属性，再初始化电动汽车特有的属性
        """
        super().__init__(make, model, year)
        self.battery = Battery()

